home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 05 - 1989 / 05.05 May 89 / Who Stuff / FileStuff.p < prev    next >
Encoding:
Text File  |  1989-03-04  |  986 b   |  34 lines  |  [TEXT/PJMM]

  1. unit Filestuff;
  2. { From Macintosh Technical Notes #24 }
  3. { by Bryan Stearns}
  4.  
  5. interface
  6.     function GetIndVolume (whichVol: integer; var volName: str255; var volRefNum: Integer): OSErr;
  7.  
  8. implementation
  9.  
  10.     function GetIndVolume;  {(whichVol: integer, var volName: str255, var volRefNum: Integer): OSErr;}
  11.  
  12. {Return the name and vRefNum of volume specified by whichVol}
  13.  
  14.         var
  15.             volPB: HParamBlockRec;
  16.             error: OSErr;
  17.     begin
  18.         with volPB do                    {makes it easier to fill in!}
  19.             begin
  20.                 ioNamePtr := @volName;    {make sure it returns the name}
  21.                 ioVRefNum := 0;            {0 means use ioVolIndex}
  22.                 ioVolIndex := whichVol;    {use this to determine the volume}
  23.             end; {with}
  24.         error := PBHGetVInfo(@volPB, false);    {do it}
  25.         if error = noErr then
  26.             begin
  27.                 volRefNum := volPB.ioVRefNum;
  28.             end; {if no error}
  29. {other information is available from this record; see the FILE }
  30. {Manager's description of PBHGetVInfo for more details}
  31.         GetIndVolume := error; {return error code}
  32.     end;
  33.  
  34. end.  {of unit}